package Projekt;

import java.awt.*;

/**
 * 
 * Erzeugen eines Polygons aus gegebenen Punkten.
 *
 */
public class Polygon implements Paintable {
	
	private static final long serialVersionUID = 1L;

	private Point[] point = new Point[40];
	private int[] pointX = new int[40];
	private int[] pointY = new int[40];
	private Color color;
	private int pointCount = 0;
	
	public Polygon(){
		super();
	}
	
	public Polygon(Point[] point, Color color) {
		this.point = point;
		this.color = color;
		
	}
	
	public Point getPoint(int number){
		return point[number];
	}
	
	public int getPointNumber(){
		return pointCount+1;
	}
	
	public void setCol(Color color) {
		this.color = color;
	}

	public void setP(Point point, int number) {
		this.pointX[number] = point.x;
		this.pointY[number] = point.y;
		this.point[number] = point;
		this.pointCount = number;
	}
	public Point getP(int number){
		return point[number];
	}

	public void painting(Graphics2D g2d, boolean temp) {
		//fuer gestrichelte Linie
		g2d.setPaint(color);
		g2d.drawPolygon(pointX, pointY, pointCount+1);
	}
}
